home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000019_icon-group-sender _Sat Jul 17 18:30:06 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  4KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 20 Jul 1993 19:46:19 MST
  2. Date: 17 Jul 93 18:30:06 GMT
  3. From: dog.ee.lbl.gov!overload.lbl.gov!agate!spool.mu.edu!uwm.edu!linac!uchinews!ellis!goer@ucbvax.Berkeley.EDU  (Richard L. Goerwitz)
  4. Organization: University of Chicago
  5. Subject: Re: Help sought tuning Icon programs
  6. Message-Id: <1993Jul17.183006.22395@midway.uchicago.edu>
  7. References: <1993Jul17.174448.23138@walter.bellcore.com>
  8. Sender: icon-group-request@cs.arizona.edu
  9. To: icon-group@cs.arizona.edu
  10. Status: R
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12.  
  13. norman@flaubert.bellcore.com (Norman Ramsey) writes:
  14. >
  15. >I have a useful Icon program of about 1400 lines, but its utility is
  16. >greatly diminished by its lack of speed.
  17.  
  18. This is a typical problem I have as well.  There's always a big ques-
  19. tion I have to answer, before writing an application, just how big and
  20. slow it will be :-), and hence whether I should take the time and trou-
  21. ble to write it in C.  If I can, I'll always try to get away with Icon
  22. because of the dramatically reduced time it takes to produce and debug
  23. working code.
  24.  
  25. Generally, if I'm going to use Icon, there are several things I can do
  26. to see if obvious speed improvements can be made.  The first is to use
  27. the compiler.  Much has been made here about the Icon compiler's experi-
  28. mental nature, and the existence of bugs in it.  I've found, though,
  29. that if I can get things compiled on a SPARC, they usually run correctly,
  30. and the speed increase can be anywhere from two to a hundredfold.
  31.  
  32. Another useful trick is to run a simple profiler.  In the Icon program
  33. library, there is a simple program called "profile" that runs under
  34. UNIX (and could probably be made to run under any serious operating
  35. system).  All it does is take an Icon program compiled with the trace
  36. option on (icont -t) and perform some rough statistics on what proce-
  37. dures are being called the most and from where.  It's meant for inter-
  38. active use.  You can, if you like, use it with programs not compiled
  39. with tracing on, but rather with tracing manually set (&trace := -1) at
  40. the point in the program where you want to start gathering statistics.
  41.  
  42. A final way of profiling Icon code is to use another Icon Program Lib-
  43. rary program called "empg."  This is essentially an expression timing
  44. utility.  You just give it a file containing the expressions you want
  45. to time, and it gives you an Icon file that, when run, times those ex-
  46. pressions, and then prints a summary of how long they took to run.  This
  47. is the sort of utility you'd run if you had a question about whether it
  48. was significantly faster to do things in a certain way, as compared to
  49. some other way.
  50.  
  51. One last recommendation I'd make is that you simply post questions as
  52. they arise.  This group has a couple of real die-hards, and a lot of
  53. bright, interested people.  Icon isn't like Pascal or C - you have to
  54. have an innovatory or inquisitive spirit to have found out about it, &
  55. to have acquired facility with it.  The folks who read this group are
  56. likely to have some really good suggestions about how to clean up any
  57. code you write.  A case in point is the sortff routine I posted a while
  58. back.  Bob Alexander just rewrote it for me for fun (!), and returned
  59. a version that runs about five times as fast as my initial version.  I
  60. took his code, debugged it, and now am testing it out.  You'll be seeing
  61. it in a couple of days.  (Thanks, Bob.)
  62.  
  63. Hope this helps, Norman!
  64.  
  65. -- 
  66.  
  67.    -Richard L. Goerwitz              goer%midway@uchicago.bitnet
  68.    goer@midway.uchicago.edu          rutgers!oddjob!ellis!goer
  69.